Skip to content

Conversation

@beliefer
Copy link
Contributor

What changes were proposed in this pull request?

This PR propose to make Postgres dialect supports pushdown datetime functions.

Why are the changes needed?

Currently, DS V2 pushdown framework pushed the datetime functions with in a common way. But Postgres doesn't support some datetime functions.

Does this PR introduce any user-facing change?

'No'.
This is a new feature for Postgres dialect.

How was this patch tested?

GA.

Was this patch authored or co-authored using generative AI tooling?

'No'.

@github-actions github-actions bot added the SQL label Sep 23, 2024
@beliefer beliefer changed the title [WIP][SPARK-49756][SQL] Postgres dialect supports pushdown datetime functions. [SPARK-49756][SQL] Postgres dialect supports pushdown datetime functions. Sep 24, 2024
@beliefer
Copy link
Contributor Author

beliefer commented Sep 24, 2024

ping @cloud-fan Please help me review this PR.

}
}

override def compileExpression(expr: Expression): Option[String] = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is an interesting change. Shall we do this by default? It's better to push down nothing than failing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#48322 will avoid the issue.

}
}

override def testDatetime(tbl: String): Unit = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just for my curiosity, what does super.testDatatime do? an empty function?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Just is an empty function.

@cloud-fan
Copy link
Contributor

thanks, merging to master!

@cloud-fan cloud-fan closed this in ab1315b Oct 10, 2024
@beliefer
Copy link
Contributor Author

@cloud-fan Thank you!

cloud-fan added a commit that referenced this pull request Feb 28, 2025
…ushing down EXTRACT

### What changes were proposed in this pull request?

This is a followup of #48210 to fix correctness issues caused by pgsql filter pushdown. These datetime fields were picked wrongly before, see https://neon.tech/postgresql/postgresql-date-functions/postgresql-extract

### Why are the changes needed?

bug fix

### Does this PR introduce _any_ user-facing change?

Yes, query result is corrected, but this bug is not released yet.

### How was this patch tested?

updated test

### Was this patch authored or co-authored using generative AI tooling?

no

Closes #50101 from cloud-fan/pgsql.

Authored-by: Wenchen Fan <[email protected]>
Signed-off-by: Wenchen Fan <[email protected]>
cloud-fan added a commit that referenced this pull request Feb 28, 2025
…ushing down EXTRACT

### What changes were proposed in this pull request?

This is a followup of #48210 to fix correctness issues caused by pgsql filter pushdown. These datetime fields were picked wrongly before, see https://neon.tech/postgresql/postgresql-date-functions/postgresql-extract

### Why are the changes needed?

bug fix

### Does this PR introduce _any_ user-facing change?

Yes, query result is corrected, but this bug is not released yet.

### How was this patch tested?

updated test

### Was this patch authored or co-authored using generative AI tooling?

no

Closes #50101 from cloud-fan/pgsql.

Authored-by: Wenchen Fan <[email protected]>
Signed-off-by: Wenchen Fan <[email protected]>
(cherry picked from commit 208a7ee)
Signed-off-by: Wenchen Fan <[email protected]>
zifeif2 pushed a commit to zifeif2/spark that referenced this pull request Nov 14, 2025
…ushing down EXTRACT

### What changes were proposed in this pull request?

This is a followup of apache#48210 to fix correctness issues caused by pgsql filter pushdown. These datetime fields were picked wrongly before, see https://neon.tech/postgresql/postgresql-date-functions/postgresql-extract

### Why are the changes needed?

bug fix

### Does this PR introduce _any_ user-facing change?

Yes, query result is corrected, but this bug is not released yet.

### How was this patch tested?

updated test

### Was this patch authored or co-authored using generative AI tooling?

no

Closes apache#50101 from cloud-fan/pgsql.

Authored-by: Wenchen Fan <[email protected]>
Signed-off-by: Wenchen Fan <[email protected]>
(cherry picked from commit e65434e)
Signed-off-by: Wenchen Fan <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants